/**
 * 建立webSocket连接
 */
import { serverStore } from "@/stores/server"
import { useWebSocket } from "@vueuse/core";

const { server } = serverStore()

// 客户端标识
const clientId = Math.random()
    // Math.random.toString(36).substring(2) + "实时在站人数"

const sendWs = (url) => {
    const { data } = useWebSocket(
        `${server}${url}/${clientId}`
        , {
    autoReconnect: true
        })
    
    return data
}

export default sendWs